#ifndef _CMS_XMLTOSHM_H
#define _CMS_XMLTOSHM_H

#include <netinet/in.h>	/*for ntohl*/


/*.cms version, now it's version 1*/
#define	CMS_FILE_VERSION	1
/*for cmsXml_obj_id.h use*/
#define DEF_STR "#define "

#define	LIST_ENQUEUE_BY_ORDER(head, node) {							\
	node->prev = NULL;												\
	node->next = NULL;												\
	if(!head){														\
		head = node;												\
	}else{															\
		node->next = head;											\
		while((node->next) && (node->next->order <= node->order)){	\
			node->prev = node->next;								\
			node->next = node->next->next;							\
		}															\
		if(node->next)												\
			node->next->prev = node;								\
		if(node->prev)												\
			node->prev->next = node;								\
		else														\
			head = node;											\
	}																\
}

#if 0
typedef struct functionList_s{
        struct functionList_s *prev;
        struct functionList_s *next;
        uint32_t order;
        char functionName[256];
}functionList_t;
#endif

int cmsXml_regObjectId(objectNode_t *node, parentList_t *pList);
objectNode_t *avlInsert( objectNode_t *oldNode, objectNode_t *addNode);
cmsoffset_t cmsXml_Malloc(int size);
objectNode_t *cmsXml_NewNode(void);
cmsoffset_t cmsXml_Free(int size);
int cmsXml_addParameter(objectNode_t *node, objParameter_t *parameter);
objectNode_t *cmsXml_LinkIndexChild( objectNode_t *node, int number, cmsoffset_t filterAttr );
int cmsXml_SetNodeName(objectNode_t *node, char *name);
int cmsXml_LinkSiblingNode(objectNode_t *parent, objectNode_t *addNode);
int cmsXml_IndexChildCopyNode( objectNode_t *node, parentList_t *pList );
int cmsXml_LinkChildNode(objectNode_t *parent, objectNode_t *child);
uint32_t getRdmTotalSize( void );
void addRdmTotalSize( uint32_t size );


#endif

